﻿function getcallermsg(){
	var url="/tools/ajax.aspx?type=getcallermsg";
	var xmlHttp=GetXmlHttpObject();
	xmlHttp.open("GET",encodeURI(url),true);
	xmlHttp.setRequestHeader("If-Modified-Since", "0");
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
				if(xmlHttp.status==200){
				   //var html='<input type="button" value="OK" />';
				    var div=getId("robDiv");
				    if(div==null){
				        div=document.createElement("div");
				        div.id="robDiv";
				        div.className="messagebox";
				        document.getElementsByTagName("body")[0].appendChild(div);
				    }
				    if(xmlHttp.responseText.length==0){
				        div.parentNode.removeChild(div);				       
				    }
				    else{
				        div.innerHTML=xmlHttp.responseText;
				        getId("callerClose").onclick=function(){div.parentNode.removeChild(div);}
				    }
				    setTimeout(getcallermsg,30*1000);
				    window.onscroll();	    
				}
			}
	};
	xmlHttp.send(null);
}
function GetXmlHttpObject(){
  var xmlHttp=null;
  try{
	// Firefox, Opera 8.0+, Safari
	xmlHttp=new XMLHttpRequest();
	}
  catch (e){
	// Internet Explorer
	try{
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	catch (e){
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	}
  return xmlHttp;
}
var tmpWindowScroll100908=window.onscroll;
window.onscroll = function() {
    if(typeof(tmpWindowScroll100602)=="function") tmpWindowScroll100908();
    var content = getId("callermsgDiv");
    if(content==null) return;
    var offsetTop = document.documentElement.clientHeight - 170;
    var offsetLeft = document.documentElement.clientWidth - 260;
    content.style.top = document.documentElement.scrollTop + offsetTop + "px";
    content.style.left = document.documentElement.scrollLeft + offsetLeft + "px";
    if (navigator.userAgent.indexOf('Safari') != -1) {
       if (window.scrollY == 0) {
            content.style.top = window.scrollY + offsetTop + "px";
            content.style.left = window.scrollX + offsetLeft + "px";
        }
        else {
            content.style.top =window.scrollY +  offsetTop + 60 + "px";
            content.style.left = window.scrollX + offsetLeft + "px";
        }
    }
}
var tmpWindowLoad100908=window.onload
window.onload=function(){
    if(typeof(tmpWindowLoad100602)=="function") tmpWindowLoad100908();
    getcallermsg();
}
